//
//  ILGLibViewController.m
//  ILGDemo
//
//  Created by zhangtongle-Pro on 2017/9/6.
//  Copyright © 2017年 Happy. All rights reserved.
//

#import "ILGLibViewController.h"
#import "ILGTestModel.h"
#import "ILGLibViewController+Category.h"
#include "ILGTestC.h"
#include "ILGTestC.h"

@protocol ILGLibViewController <NSObject>
@property (nonatomic, copy) NSString *protocolName;
@end

@interface ILGLibViewController () <ILGLibViewController>
@property (nonatomic, strong) ILGTestModel *model;
@property (nonatomic, assign) NSNumber *number;
@property (nonatomic, strong) NSNumber *number2;
@property (nonatomic, strong) NSNumber *number3;
@property (nonatomic, strong) NSNumber *number4;

@property (nonatomic, strong, class) NSString *className;
@end

@implementation ILGLibViewController
{
    NSObject *_runloopObject;
}

+ (void)load {
    NSLog(@"%s", __func__);
    NSLog(@"%s, %@", __func__, self);
}

+ (void)initialize {
    NSLog(@"%s", __func__);
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.navigationItem.title = @"ILGLib";
    [self learnForOthers];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    
}

- (void)dealloc
{
    NSLog(@"%s", __func__);
}


#pragma mark - others

- (IBAction)buttonClicked:(UIButton *)sender {
//    objc_msgSend(_runloopObject, NSSelectorFromString(@"performTask"));
//    objc_msgSend(_runloopObject, NSSelectorFromString(@"stopRunloop"));
    NSLog(@"self.countNum = %@", self.number);
    
    Class class = NSClassFromString(@"ILGTestVC");
    [self.navigationController pushViewController:[[class alloc] init] animated:YES];
}


- (void)learnForOthers
{
    Class class = NULL;
//    Class class = NSClassFromString(@"ILGMultiThreadModule");
    class = NSClassFromString(@"ILGAlgorithmModule");
//    Class class = NSClassFromString(@"ILGRunloopModule");
//    Class class = NSClassFromString(@"ILGRuntimeModule");
//    class = NSClassFromString(@"ILGLearningForCModule");
//    class = NSClassFromString(@"ILGMemoryModule");
    
    NSObject *object = [[class alloc] init];
//    _runloopObject = object;
    objc_msgSend(object, NSSelectorFromString(@"performTestMethod"));
//    
//    self.model = model;
    
//    CADisplayLink *displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(actionForDisplayLink)];
//    displayLink.preferredFramesPerSecond = 1; //在子线程中设置没用，好像依然60帧/s
//    [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    
    NSLog(@"git rebase test 1");
    NSLog(@"git rebase test 2");
    NSLog(@"git rebase test 3");
    NSLog(@"git rebase test 6");
    NSLog(@"git rebase test 7");
    NSLog(@"git rebase test 8");
    NSLog(@"git rebase test 9");
    NSLog(@"git rebase release 2");
    NSLog(@"git rebase release 3");
    
    NSLog(@"git rebase release 11");
    NSLog(@"git rebase release 12");
}

- (void)actionForDisplayLink
{
    NSLog(@"%s, %@", __func__, [NSThread currentThread]);
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
    
}

@synthesize protocolName = _protocolName;

@end
